import request from '@/config/axios'

// 招生阶段 VO
export interface BatchStageVO {
  id: string // 主键
  stageName: string // 阶段名称
  batchId: string // 所属计划ID
  recruitAmount: number // 限制报名人数
  recruitStartTime: Date // 报名时间(开始)
  recruitEndTime: Date // 报名时间(结束)
  summerEnable: boolean // 报名类型-夏令营
  recommendEnable: boolean // 报名类型-预推免
  unifiedEnable: boolean // 报名类型-统考复试
  remark: string // 备注
}

// 招生阶段 API
export const BatchStageApi = {
  // 查询招生阶段分页
  getBatchStagePage: async (params: any) => {
    return await request.get({ url: `/recruit/batch-stage/page`, params })
  },

  // 查询招生阶段详情
  getBatchStage: async (id: string) => {
    return await request.get({ url: `/recruit/batch-stage/get?id=` + id })
  },

  // 新增招生阶段
  createBatchStage: async (data: BatchStageVO) => {
    return await request.post({ url: `/recruit/batch-stage/create`, data })
  },

  // 修改招生阶段
  updateBatchStage: async (data: BatchStageVO) => {
    return await request.put({ url: `/recruit/batch-stage/update`, data })
  },

  // 删除招生阶段
  deleteBatchStage: async (id: string) => {
    return await request.delete({ url: `/recruit/batch-stage/delete?id=` + id })
  },

  // 导出招生阶段 Excel
  exportBatchStage: async (params) => {
    return await request.download({ url: `/recruit/batch-stage/export-excel`, params })
  },

  //
  // 查询招生阶段详情
  getOccupiedTimeRangeByBatchId: async (batchId: string) => {
    return await request.get({ url: `/recruit/batch-stage/occupied-range?batchId=` + batchId })
  }
}
